﻿<%@ Page Title="Report Filters - Multimedia" Language="C#" MasterPageFile="~/Users/NewDesign.Master"
    AutoEventWireup="true" Inherits="MediaMonitor.Users.NewAll_newsalert_Filter"
    CodeBehind="NewAll-newsalert-Filter.aspx.cs" %>

<%--@ OutputCache Duration="3600" VaryByParam="none"--%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Charting" Assembly="Telerik.Web.UI" %>
<%@ Register Src="~/Controls/AutoCompleteExtender.ascx" TagPrefix="ctrl" TagName="AutoComplete" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="Server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">

            function DateSelected(sender, eventArgs) {


                var date1 = eventArgs.get_renderDay().get_date();
                var dfi = sender.DateTimeFormatInfo;
                var formattedDate = dfi.FormatDate(date1, dfi.ShortDatePattern);

                var calE = $find("<%= calE.ClientID %>");
                var str = date1.toString();
                var ret = str.split(",");


                calE.selectDate(date1, true)
                $('#lblSelectedFromDate').text(ret[0] + '/' + ret[1] + '/' + ret[2]);
                var str2 = calE.get_selectedDates().toString();
                var ret2 = str2.split(",");

                $('#lblSelectedToDate').text(ret2[0] + '/' + ret2[1] + '/' + ret2[2]);

                //calE.get_selectedDates()
            }
            function DateSelected1(sender, eventArgs) {


                var date11 = eventArgs.get_renderDay().get_date();

                var str3 = date11.toString();
                var ret3 = str3.split(",");


                $('#lblSelectedToDate').text(ret3[0] + '/' + ret3[1] + '/' + ret3[2]);
                //calE.get_selectedDates()
            }
        </script>
    </telerik:RadCodeBlock>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">

 
    <asp:Panel ID="pnlSearch" runat="server" CssClass="news-main">
        <table style="background-color: rgba(218, 250, 250, 0.9); border: 10px solid; width: 100%;
            padding: 20px;">
            <tr>
                <td>
                    <h5>
                        <b>Dates</b></h5>
                    <br />
                </td>
                <td>
                    <asp:HiddenField runat="server" ID="hdnDate" ClientIDMode="Static" />
                     <asp:HiddenField runat="server" ID="hdnDateTo" ClientIDMode="Static" />
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <table>
                        <tr valign="top">
                            <td class="calender">
                                From Date
                                <asp:Label ID="lblSelectedFromDate" runat="server" ClientIDMode="Static" Text=""
                                    Font-Size="16px" ForeColor="Red"></asp:Label>
                                <br />
                                <telerik:RadCalendar AutoPostBack="false" ID="calS" runat="server" EnableMultiSelect="false"
                                    ClientEvents-OnDateSelected="DateSelected">
                                </telerik:RadCalendar>
                            </td>
                            <td>
                                <div style="width: 50px;">
                                </div>
                            </td>
                            <td class="calender">
                                To Date
                                <asp:Label ID="lblSelectedToDate" runat="server" ClientIDMode="Static" Text="" Font-Size="16px"
                                    ForeColor="Red"></asp:Label>
                                <br />
                                <telerik:RadCalendar AutoPostBack="false" ID="calE" runat="server" EnableMultiSelect="false"
                                    ClientEvents-OnDateSelected="DateSelected1">
                                </telerik:RadCalendar>
                            </td>
                            <td class="calender">
                                <br />
                                <br />
                                <asp:CheckBoxList ID="chklstDays" runat="server">
                                    <asp:ListItem Value="6" Text="Sunday"></asp:ListItem>
                                    <asp:ListItem Value="0" Text="Monday"></asp:ListItem>
                                    <asp:ListItem Value="1" Text="Tuesday"></asp:ListItem>
                                    <asp:ListItem Value="2" Text="Wednesday"></asp:ListItem>
                                    <asp:ListItem Value="3" Text="Thursday"></asp:ListItem>
                                    <asp:ListItem Value="4" Text="Friday"></asp:ListItem>
                                    <asp:ListItem Value="5" Text="Saturday"></asp:ListItem>
                                </asp:CheckBoxList>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <small><u class="ErrorText">Note:</u> only dates in blue color are valid dates having
                                    commercial's data.</small>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <br />
                    String to Search
                </td>
                <td>
                    <br />
                    <asp:TextBox ID="txtNewsTitle" runat="server" Width="234px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Search on
                </td>
                <td>
                    Title:<asp:CheckBox ID="chkTitle" runat="server" Checked="true" />
                    &nbsp;&nbsp;Summary:
                    <asp:CheckBox ID="chkSummary" runat="server" Checked="true" />
                    &nbsp;&nbsp;Text:<asp:CheckBox ID="chkText" runat="server" Checked="true" />
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <br />
                    <br />
                    <h5>
                        <b>Options</b></h5>
                    <br />
                </td>
                <td colspan="3">
                </td>
            </tr>
            <tr>
                <td>
                    Advertiser
                </td>
                <td>
                    <asp:DropDownList ID="lstAdvertiser" runat="server" DataTextField="AdvertiserName" />
                </td>
            </tr>
            <tr>
                <td>
                    Calificacion
                </td>
                <td>
                    <asp:DropDownList ID="lstNewsType" runat="server">
                        <asp:ListItem Text="-ALL-" Value="0"></asp:ListItem>
                        <asp:ListItem Text="POSITIVA" Value="1"></asp:ListItem>
                        <asp:ListItem Text="NEGATIVA" Value="2"></asp:ListItem>
                        <asp:ListItem Text="NEUTRA" Value="3"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
             <tr>
                <td>
                Importancia 
                </td>
                <td>
                <asp:DropDownList ID="lstImportancia" runat="server" >
                                    <asp:ListItem Value="0" Text="-ALL-"></asp:ListItem>
                                    <asp:ListItem Value="1" Text="1"></asp:ListItem>
                                    <asp:ListItem Value="2" Text="2"></asp:ListItem>
                                    <asp:ListItem Value="3" Text="3"></asp:ListItem>
                                    <asp:ListItem Value="4" Text="4"></asp:ListItem>
                                    <asp:ListItem Value="5" Text="5"></asp:ListItem>
                                </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    News Media Types
                </td>
                <td>
                    <%--<asp:DropDownList ID="lstNewsMediaType" runat="server" AutoPostBack="true"
                OnSelectedIndexChanged="lstNewsMediaType_SelectedIndexChanged">
                <asp:ListItem Text="-ALL-" Value="0"></asp:ListItem>
                <asp:ListItem Text="TV" Value="1"></asp:ListItem>
                <asp:ListItem Text="Radio" Value="3"></asp:ListItem>
                <asp:ListItem Text="Press" Value="6"></asp:ListItem>
                </asp:DropDownList>--%>
                    <table>
                        <tr>
                            <td>
                                <asp:CheckBox runat="server" ID="chkMediaAll" Text="All" Checked="true" />
                            </td>
                            <td>
                             <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                                        <asp:CheckBoxList ID="chkNewsMediaType" runat="server" AutoPostBack="true" DataValueField="MediaTypeCode"
                                            CssClass="chk" DataTextField="MediaTypeName"  OnSelectedIndexChanged="chkNewsMediaType_SelectedIndexChanged"
                                            RepeatDirection="Horizontal">
                                        </asp:CheckBoxList>
                                         </ContentTemplate>
     <Triggers>
     <asp:AsyncPostBackTrigger ControlID="chkNewsMediaType" EventName="SelectedIndexChanged" />
     </Triggers>
        </asp:UpdatePanel>
                                   
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr valign="top">
                <td>
                    Channel / Media Name
                </td>
                <td style="font-size: small;">
                  <asp:UpdatePanel ID="pnlUpdate_Media1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                                    <ContentTemplate>
                    <asp:CheckBox ID="chkAllMedia" runat="server" Text=" Search from all Media Channels"
                        Checked="true" AutoPostBack="true" OnCheckedChanged="chkAllMedia_Changed" />
                    <asp:Panel ID="panelMediaList" class="Box" runat="server" Visible="false">
                        <asp:CheckBoxList ID="lstMedia" runat="server" DataValueField="MediaCode" DataTextField="MediaName"
                            RepeatColumns="5" RepeatDirection="Horizontal" Font-Size="8px">
                        </asp:CheckBoxList>
                    </asp:Panel>
                     </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="chkNewsMediaType" EventName="SelectedIndexChanged" />
                                    </Triggers>
                                </asp:UpdatePanel>
                    <br />
                    <br />
                    <br />
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td colspan="3">
                    <asp:Button ID="btnSearch1" runat="server" CssClass="btn primary" Text="Search" OnClick="btnSearch_Click" />
                    <%-- <asp:ImageButton ID="btnSearch" runat="server"  OnClick="btnSearch_Click" SkinID="Search" />--%>
                </td>
            </tr>
        </table>
    </asp:Panel>
  
    <script>
        $("#ctl00_Body_chkMediaAll").click(function (eventData) {
            var checked = $(eventData.currentTarget).prop("checked");
           
            if (checked) {

                $(".chk input[type=checkbox]").prop("checked", false);
            }
        });
        $(".chk input[type=checkbox]").click(function (eventData) {
            var checked = $(eventData.currentTarget).prop("checked");
           
            if (checked) {
                $("#ctl00_Body_chkMediaAll").prop("checked", false);
            }
        });
        $(".chk input[type=checkbox]").live("click", function (eventData) {
            var checked = $(eventData.currentTarget).prop("checked");
           
            if (checked) {
                $("#ctl00_Body_chkMediaAll").prop("checked", false);
            }
        });
       
    </script>
</asp:Content>
